package com.gitee.kamismile.disruptorEx.common;

import com.gitee.kamismile.disruptorEx.commandhandling.CommandMessage;
import com.gitee.kamismile.disruptorEx.commandhandling.callbacks.LoggingCallback;
import com.gitee.kamismile.disruptorEx.commandhandling.gateway.DefaultCommandGateway;
import com.gitee.kamismile.disruptorEx.commandhandling.gateway.EnableDisruptor;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.context.annotation.ImportResource;

//@SpringBootApplication
//@EnableAspectJAutoProxy(proxyTargetClass = true, exposeProxy = true)
////@ImportResource("classpath*:config/spring*.xml")
////@ComponentScan(basePackages = "com.gitee.kamismile.disruptorEx")
//@EnableDisruptor
public class DisruptorApplication {



    public static void main(String[] args) throws InterruptedException {
        ConfigurableApplicationContext aa = SpringApplication.run(DisruptorApplication.class, args);
        DefaultCommandGateway c= aa.getBean(DefaultCommandGateway.class);
        c.sendCallback(new CommandMessage() {
            @Override
            public String getCommandName() {
                return "aa";
            }
            @Override
            public Object doCmd() {
                return 12312;
            }
        },LoggingCallback.INSTANCE);

    c.sendCallback(new CommandMessage() {
            @Override
            public String getCommandName() {
                return "aaaaaaaa";
            }
            @Override
            public Object doCmd() {
                return 121D;
            }
        },LoggingCallback.INSTANCE);
    }

}
